﻿using ZilLion.Service.Core.DapperWrapper;
using ZilLion.Service.Core.DapperWrapper.SqlServer;
using ZilLion.Service.WeChatMall.Domain.Entitys.GsInfo;
using ZilLion.Service.WeChatMall.Domain.Repositorys.Interface.GoodInfo;

namespace ZilLion.Service.WeChatMall.Domain.Repositorys.GoodInfo
{
    public class OfflineGsRelationshipReponsitory : SqlServerRespository<OfflineGsRelationshipEntity>,
        IOfflineGsRelationshipReponsitory
    {
        public OfflineGsRelationshipReponsitory()
        {
            Context = new WechatMallContext();
        }
        public void AddRelationship(OfflineGsRelationshipEntity entity, UnitOfWork unit)
        {
            Add(entity, unit);
        }

        public void DeleteRelationshipByOfflineGs(int gsid, string zlcompanykey, UnitOfWork unit)
        {
           DapperHelper.Execute(@"delete from offlinegsrelationship where offlinegsid=@gsid and zlcompanykey=@zlcompanykey", Context,unit,new { gsid, zlcompanykey });
        }

        public void DeleteRelationshipByOnlineGs(long gsid,  UnitOfWork unit)
        {
            DapperHelper.Execute(@"delete from offlinegsrelationship where gsid=@gsid", Context, unit, new { gsid  });
        }
    }
}